﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace LightCAD.Core
{
    public class Rect2d : ICurve2d
    {
        /// <summary>
        /// 左下角
        /// </summary>
        [JsonInclude]
        public Vector2d Min;
        /// <summary>
        /// 右上角
        /// </summary>
        [JsonInclude]
        public Vector2d Max;

        public Curve2dType Type => Curve2dType.Rect2d;

        [JsonIgnore]
        public bool IsClosed => true;

        [JsonIgnore]
        public object Source { get; set; }
        public string Name { get ; set ; }

        public void Copy(ICurve2d src)
        {
            var rect = src as Rect2d;
            this.Min = rect.Min;
            this.Max = rect.Max;
            this.Name = rect.Name;
        }
        public ICurve2d Clone()
        {
            var newObj = new Rect2d();
            newObj.Copy(this);
            return newObj;
        }
        object ICloneable.Clone()
        {
            return this.Clone();
        }
    }
}
